<template>
  <div class="webveiw page">
    <van-nav-bar :title="title" class="bg_white" left-arrow @click-left="barkGo" />
    <div class="content" id="content">
      <div class="loading-wp" v-if="isLoading">
        <van-loading size="44" />
      </div>
      <iframe :src="iframeSRC" ref="iframe" class="iframe" />
    </div>
  </div>
</template>
<script>
export default {
  name: 'webveiw',
  data () {
    return {
      title: '',
      exec_obj: undefined,
      isLoading: false,
      iframeSRC: localStorage.getItem('iframeSRC')
    };
  },
  created () {
  },
  mounted () {
    this.$nextTick(() => {
      this.isLoading = true;
      this.$refs.iframe.onload = () => {
        this.isLoading = false;
      };
    });
  },
  methods: {
    barkGo () {
      localStorage.removeItem('iframeSRC');
      this.$router.go(-1);
    }
  }
};
</script>
<style lang="less" scoped>
.webveiw {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  .nav-bar {
    position: relative;
    .loading {
      position: absolute;
      top: 0;
      left: 100px;
      right: 100px;
      bottom: 0;
    }
  }
  .content {
    flex: 1;
    overflow: auto;
    position: relative;
    .loading-wp {
      display: flex;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      justify-content: center;
      align-items: center;
    }
    .iframe {
      width: 100%;
      height: 100%;
      border: none;
    }
  }
}
</style>
